OfflineRegion

An offline region is the basic building block for offline mobile maps. Use com.mapbox.mapboxsdk.offline.OfflineManager.CreateOfflineRegionCallback to create a new offline region.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
annotation class DownloadState

A region is either inactive (not downloading, but previously-downloaded resources are available for use), or active (resources are being downloaded or will be downloaded, if necessary, when network access is available).

Link copied to clipboard

This callback receives an asynchronous response containing a notification when an offline region has been deleted, or a String error message otherwise.

Link copied to clipboard

This callback receives an asynchronous response containing a notification when an offline region has been invalidated, or a String error message otherwise.

Link copied to clipboard

A region can have a single observer, which gets notified whenever a change to the region's status occurs.

Link copied to clipboard

This callback receives an asynchronous response containing the OfflineRegionStatus of the offline region, or a String error message otherwise.

Link copied to clipboard

This callback receives an asynchronous response containing the newly update OfflineMetadata in the database, or an error message otherwise.

Functions

Link copied to clipboard

Remove an offline region from the database and perform any resources evictions necessary as a result.

Link copied to clipboard

Retrieve the current status of the region. The query will be executed asynchronously and the results passed to the given callback which will be executed on the main thread.

Link copied to clipboard

Invalidate all the tiles from an offline region forcing Mapbox GL to revalidate the tiles with the server before using. This is more efficient than deleting the offline region and downloading it again because if the data on the cache matches the server, no new data gets transmitted.

Link copied to clipboard
fun setDeliverInactiveMessages(deliverInactiveMessages: Boolean)

When set true, the OfflineRegionObserver will continue to deliver messages even if the region state has been set as STATE_INACTIVE (operations happen asynchronously). If set false, the client won't be notified of further messages.

Link copied to clipboard
fun setDownloadState(state: Int)

Pause or resume downloading of regional resources.

Link copied to clipboard

Register an observer to be notified when the state of the region changes.

Link copied to clipboard

Update an offline region metadata from the database.

Properties

Link copied to clipboard
Link copied to clipboard
val id: Long
Link copied to clipboard

Gets whether or not the OfflineRegionObserver will continue to deliver messages even if the region state has been set as STATE_INACTIVE.

Link copied to clipboard

Arbitrary binary region metadata. The contents are opaque to the SDK implementation; it just stores and retrieves a byte[]. Check the OfflineActivity in the TestApp for a sample implementation that uses JSON to store an offline region name.